﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NCP.Recruiting.ApplicationServices.Messaging {
    public abstract class ServiceResponseBase {
        public ServiceResponseBase() {
            this.Exception = null;
            this.Errors = new List<string>();
        }

        public IList<string> Errors { get; set; }

        /// <summary>
        /// Save the exception thrown so that consumers can read it
        /// </summary>
        public Exception Exception { get; set; }

        public bool Success { get { return this.Errors.Count == 0; } }

        public void AddError(string error)
        {
            this.Errors.Add(error);
        }
    }
}
